﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz;
using iTelluro.Explorer.Infrastructure.CrossCutting.Logging;
using iTelluro.Explorer.Infrastructure.CrossCutting.NetFramework.Logging;
using SXMeteorological.Data.Utility;

namespace SXMeteorological.DataSyn.Wind
{
    public class WindJob:IJob
    {
        private readonly ILogger _logger;
        public WindJob()
        {
            _logger = LoggerFrameFactory.CreateLog();
            _logger.LogInfo("执行风任务构造函数");
        }


        public void Execute(IJobExecutionContext context)
        {
            HourToppestWind();
        }
        /// <summary>
        /// 小时极大风速风向
        /// </summary>
        private void HourToppestWind()
        {
            try
            {
                string interfaceName = "getSurfEleInRegionByTime";
                string returnValue = "Station_Name,Lon,Lat,WIN_D_INST_Max,WIN_S_Inst_Max";
                string featureName = "极大风速的风向";
                string time = DateTime.UtcNow.ToString("yyyyMMddHH") + "0000";
                string dataCode = "SURF_CHN_MUL_HOR";
               // _logger.LogInfo(featureName + "**" + "小时极大风速风向图" + "***" + returnValue);
                CreateMap.FeatureMap(interfaceName, returnValue, dataCode, featureName, "小时极大风速风向图", time,"h");
            }
            catch (Exception ex)
            {
                _logger.LogError(string.Format("小时极大风速风向生成失败#{0}：{1}", DateTime.Now, ex.Message));
            }
        }
    }
}
